
public class SimpleArray {
	Counter counter = new Counter();
	Counter getCounter() {
		return counter;
	}
	int[] getSimpleArray(int n) {
		counter.increment();
		int[] array = new int[n];
		int p = 2;
		for (int i = 0; i < (n - 1); i++) {
			array[i] = i+2;
			//System.out.println(array[i]);
		}
		while (2*p < n) {
			//System.out.println("array[2p-2] "+array[2*p - 2]);
			for (int i = (2*p - 2); i < (n - 1); i++) {
				if (array[i] % p == 0) {
					array[i] = 0;
				}
			}
			int i = 0;
			while (((array[i] <= p))&&(i < n)) {
				i++;
			}
			//System.out.println("i = "+ i);
			if (i < n)
				p = array[i];
			//System.out.println("p = "+ p);
		}
		return array;
	}
}
